<template>
  <a-carousel autoplay arrows :dot-position="dotPosition">
    <!-- <template #prevArrow>
      <div class="custom-slick-arrow" style="left: 10px">
        <left-circle-outlined />
      </div>
    </template> -->
    <template #nextArrow>
      <div class="custom-slick-arrow" style="right: 10px">
        <right-circle-outlined />
      </div>
    </template>

    <div id="img" v-for="item in data" :key="item">
      <img :src="baseUrl + item + '.jpg'" />
    </div>
  </a-carousel>
</template>
<script lang="ts">
interface imgData {
  images: [];
}
import { LeftCircleOutlined, RightCircleOutlined } from "@ant-design/icons-vue";
import { defineComponent, onMounted, reactive, ref } from "vue";
import imgApi from "../api/web/imgApi";
export default defineComponent({
  components: {
    LeftCircleOutlined,
    RightCircleOutlined,
  },

  setup() {
    const baseUrl = "/images/";
    let data = ref([]);

    onMounted(() => {
      sizeImga();
    });

    const sizeImga = (): void => {
      imgApi.getImgName().then((reject) => {
        let d: imgData = reject.data;
        data.value = d.images;
      });
    };

    return {
      dotPosition: ref("top"),
      data,
      baseUrl,
    };
  },
});
</script>
<style scoped>
/* For demo */
.ant-carousel {
  height: 760px;
}
.ant-carousel :deep(.slick-slider) {
  height: 760px;
}
.ant-carousel :deep(.slick-slide) {
  text-align: center;
  height: 760px;
  line-height: 760px;
  overflow: hidden;
}
.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.5;
}
.ant-carousel :deep(.custom-slick-arrow:before) {
  display: none;
}
.ant-carousel :deep(.custom-slick-arrow:hover) {
  opacity: 0.5;
}

.ant-carousel :deep(.slick-slide img) {
  position: relative;
  width: 100%;
  height: 760px;
  /* display: none; */
  /* filter: grayscale(100%); */
}

#img {
  width: 100%;
  height: 760px;
}
</style>